/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.meteocal.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.GregorianCalendar;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.validation.constraints.NotNull;

/**
 *
 * @author paolo
 */
@Entity
public class Event implements Serializable {
    private static final long serialVersionUID = 1L;
    
    /*ATTRIBUTE*/
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long eventID;

    private String name;
    
    @Temporal(javax.persistence.TemporalType.TIME)
    private GregorianCalendar startHour;
    
    @Temporal(javax.persistence.TemporalType.TIME)
    private GregorianCalendar endHour;
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private GregorianCalendar startDate;
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private GregorianCalendar endDate;
    
    private String city;
    
    private String country;
    
    private String address;
   
    private Boolean outdoor; 
    
    private Boolean publicEvent;
    
    private Boolean deleted;
    
    private String description;
    
    /*RELATIONSHIP*/
    
    //EVENT-INVITEDLIST
    @OneToMany(mappedBy = "event")
    private Collection<InvitedList> invitedListCollection;
    
    //EVENT-USER
    @JoinColumn(name = "AUTHOR", referencedColumnName = "email")
    @ManyToOne
    private User author;
    
    //EVENT-FORECAST
    @JoinColumn(name = "FORECAST", referencedColumnName = "forecastID")
    @ManyToOne
    private Forecast forecast;
    
    //inverse of message(EVENT-MESSAGE)
    @OneToMany(mappedBy = "event")
    private Collection<Message> messageCollection; 

    public Long getEventID() {
        return eventID;
    }

    public void setEventID(Long eventID) {
        this.eventID = eventID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public GregorianCalendar getStartHour() {
        return startHour;
    }

    public void setStartHour(GregorianCalendar startHour) {
        this.startHour = startHour;
    }

    public GregorianCalendar getEndHour() {
        return endHour;
    }

    public void setEndHour(GregorianCalendar endHour) {
        this.endHour = endHour;
    }

    public GregorianCalendar getStartDate() {
        return startDate;
    }

    public void setStartDate(GregorianCalendar startDate) {
        this.startDate = startDate;
    }

    public GregorianCalendar getEndDate() {
        return endDate;
    }

    public void setEndDate(GregorianCalendar endDate) {
        this.endDate = endDate;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Boolean getOutdoor() {
        return outdoor;
    }

    public void setOutdoor(Boolean outdoor) {
        this.outdoor = outdoor;
    }

    public Boolean getPublicEvent() {
        return publicEvent;
    }

    public void setPublicEvent(Boolean publicEvent) {
        this.publicEvent = publicEvent;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Collection<InvitedList> getInvitedListCollection() {
        return invitedListCollection;
    }

    public void setInvitedListCollection(Collection<InvitedList> invitedListCollection) {
        this.invitedListCollection = invitedListCollection;
    }

    public User getAuthor() {
        return author;
    }

    public void setAuthor(User author) {
        this.author = author;
    }

    public Forecast getForecast() {
        return forecast;
    }

    public void setForecast(Forecast forecast) {
        this.forecast = forecast;
    }

    public Collection<Message> getMessageCollection() {
        return messageCollection;
    }

    public void setMessageCollection(Collection<Message> messageCollection) {
        this.messageCollection = messageCollection;
    }
}
